package org.example;

import instrument.MD5Util;

import java.util.Date;

public class Reception extends User {
    public Reception() {
        setUserType("前台");
    }

    public Reception(int id, String userName, String password, String telephone,
                     Date registerTime, boolean needChangePassword) {
        super(id, userName, password, "前台", telephone, registerTime, needChangePassword);
    }

    @Override
    public void inputUserInfo() {
        System.out.println("请输入前台ID:");
        setId(scanner.nextInt());
        scanner.nextLine(); // 消耗换行符

        System.out.println("请输入用户名:");
        setUserName(scanner.nextLine());

        System.out.println("请输入密码:");
        String password = scanner.nextLine();
        setPassword(MD5Util.encrypt(password)); // 加密存储

        System.out.println("请输入电话:");
        setUserTelephone(scanner.nextLine());

        setRegisterTime(new Date());
        setNeedChangePassword(false);
    }
}